package com.qkhero.api.errorcode;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by zhengwei on 2017/4/16.
 */
public enum ErrorCodeEnum {

    SERVER_ERROR("500", "系统错误，请稍后再试"),



    ;

    private String code;
    private String desc;

    ErrorCodeEnum(String code, String desc) {
        this.desc = desc;
        this.code = code;
    }

    private static Map<String, ErrorCodeEnum> cache = new HashMap<String, ErrorCodeEnum>(values().length);

    static {

        for (ErrorCodeEnum e : values()) {
            cache.put(e.code, e);
        }
    }

    public static ErrorCodeEnum get(String code) {
        return cache.get(code);
    }

    public String getDesc() {
        return desc;
    }

    public String getCode() {
        return code;
    }


}
